package service.impl;

import entity.Projects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.ProjectsRepository;
import service.ProjectsService;

import java.util.List;

@Service
public class ProjectsServiceImpl implements ProjectsService {
    @Autowired
    private ProjectsRepository projectsRepository;

    public Integer save(Object o) {
        Projects projects = (Projects) o;
        return projectsRepository.save(projects);
    }

    public List findAll() {
        return projectsRepository.findAll();
    }

    public void delete(Integer id) {
        projectsRepository.delete(id);
    }

    public Integer update(Object o) {
        Projects projects = (Projects) o;
        projectsRepository.saveOrUpdate(projects);
        return projects.getId();
    }
}
